import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 通知通告维护列表分页查询
export const pageNotificationMaintaion = (_params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/notification`, { params:_params,menuId:'-1' });

// 通知通告新增
export const addNotification = (params) => axios.post(`${SERVER.CMSCLOUD_CHANNEL}/notification/add`, params, {menuId:'-1'});

// 通过type获取tc_code
export const getTcCodeByType = (_params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/code/queryTcCodeByType`,{ params:_params,menuId:'-1' });

// 通过ID获取通知通告数据
export const getNotificationById = (id,source) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/notification/detail/${id}`, {params:{id: Number(id),source},menuId:'-1'});

// 通过ID修改通知通告数据
export const updateNotification = (params,id) => axios.put(`${SERVER.CMSCLOUD_CHANNEL}/notification/update/${id}`, params,{id: Number(id)},{menuId:'-1'});

// 通过IDS撤回已经下发的数据
export const withdrawNotificationByIds = (params) => axios.post(`${SERVER.CMSCLOUD_CHANNEL}/notification/withdraw`, params, {menuId:'-1'});

// 通过ID下发通知通告数据
export const publishNotification = (params,id) => axios.put(`${SERVER.CMSCLOUD_CHANNEL}/notification/publish/${id}`, params,{id: Number(id)},{menuId:'-1'});

// 获取所有的厂端角色
export const getOemRole = (_params) => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/roles/getRole`, { params:_params,menuId:'-1' });

//通过ID删除通知通告数据
export const deleteNotificationById = (id) => axios.delete(`${SERVER.CMSCLOUD_CHANNEL}/notification/${id}`, {params:{id:id},menuId:'-1'});

// 通知通告维护列表分页查询
export const getUserInfo = (_params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/common/getUserInfo`, { params:_params,menuId:'-1' });


// 通知通告角色分组列表分页查询
export const pageNotificationGroupList = (_params) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/notification/notificationGroup/getNotificationGroup`, { params:_params,menuId:'-1' });
// 通知公告角色分组保存
export const addOemRoleGroup = (params) => axios.post(`${SERVER.CMSCLOUD_CHANNEL}/notification/notificationGroup`, params, {menuId:'-1'});
//通知公告角色分组修改
export const updateOemRoleGroup = (params) => axios.put(`${SERVER.CMSCLOUD_CHANNEL}/notification/notificationGroup/updateGroupRole`, params, {menuId:'-1'});

//通知公告日志查询列表
export const getLogList = _params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/notification/notificationReviewLog/getList`, { params: _params, menuId: '-1' });

export const findFileByUrl = params => axios.post(`/api/file/download/url?fileUrl=` + params );

export const importConfirmSalesZone = params =>
  axios.post(`${SERVER.CMSCLOUD_CHANNEL}/notification/dealer/import`, params);
